define([
        'underscore',
        'app/utils/CommonUtils'
        ], function (
		_
    ) {


	var s = {};
	
	s.init =function($container, total, current, page_func){
		var size = $.paginationDefaultSize;
		var postfix_id="_"+(new Date()).getTime();
		
		var options = '';
		for(var i = 0; i< total ; i++){
			options = options + '<option value="'+(i+1)+'" class="">'+(i+1)+'/'+total+'</option>';
		}
		var el = $(
				'<ul id="pagination_'+postfix_id+'" data-am-widget="pagination" class="am-pagination am-pagination-select">'+
			      '<li class="am-pagination-prev">'+
			        '<button id="prev-a'+postfix_id+'" href="javascript:void(0);" class="am-pagination-prev-a am-btn am-btn-default">上一页</button>'+
			      '</li>'+
			        '<li class="am-pagination-select">'+
			          '<select class="wjt-am-pagination-select" id="pagination_select'+postfix_id+'">'+
			          	options+
			          '</select>'+
			        '</li>'+
			      '<li class="am-pagination-next ">'+
			      	'<button id="next-a'+postfix_id+'" href="javascript:void(0);" class="am-pagination-next-a am-btn am-btn-default">下一页</button>'+
			      '</li>'+
			  	'</ul>'
				);
    		
		$container.html("");
		$container.append(el);
		$('#pagination_select'+postfix_id).val(current);
		
		
		$("#prev-a"+postfix_id).click(function(){
			
			if(current != 1){
				page_func(current - 1);
			}
			
			
		});
		
		$("#next-a"+postfix_id).click(function(){
			
			if(current != total){
				page_func(current + 1);
			}
		});
		
		$("#pagination_select"+postfix_id).change(function(){
			page_func($(this).val());
		});
		
	};
	return s;

});
